import request, {createApi} from "@/soar/utils/request";

export const basePath = '/system/notice';
export const subject = '消息通知';
const api = createApi(basePath, subject);

export default {
    ...api,
	/**
	 * 读取消息
	 * @param id
	 */
	read: (id: any) => request.get(`${basePath}/read`, { params: { id } }),
	/**
	 * 更新前用户消息为已读
	 * @param ids
	 */
	updateRead: (ids: any) => request.post(`${basePath}/update-read`, { data: Array.isArray(ids) ? ids : [ids] }),
	/**
	 * 当前用户消息查询
	 * @param params
	 */
	currentUserNotice: (params: any) => request.get(`${basePath}/current-user-notice`, { params }),
	/**
	 * 当前用户消息删除
	 * @param ids
	 */
	removeUserNotice: (ids: any) =>
	  request.post(`${basePath}/remove-user-notice`, { data: Array.isArray(ids) ? ids : [ids] }),
	/**
	 * 获取当前用户未读消息，为轮询设计
	 * @param webCount 前端已知消息数量
	 */
	unread: (webCount: number) => request.get(`${basePath}/unread`, { params: { webCount } }),
};